package com.witframework.baseapp.common.basecode;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

import org.hibernate.annotations.LazyToOne;
import org.hibernate.annotations.LazyToOneOption;
import org.javalid.annotations.validation.MaxLength;

import com.witframework.core.annotations.Wit;
import com.witframework.core.structure.BaseWitObject;

@Entity @Table(name="C_CATEGORY_CODE") 
@Wit(cnname="分类",description="用于分类的实体")
public class CategoryCode extends BaseWitObject{
	
	
	@Wit(cnname="分类名称")
	@Column(length=100,nullable=false)@MaxLength(length=50)
    private String name;
	
	@Wit(cnname="分类代码")
	@Column(length=100)@MaxLength(length=50)
	private String type_code;
	
	@Column(length=32,nullable=false)
    private String parent_id; 
	
	@Wit(cnname="删除状态",description="只能通过设置该状态为YES来逻辑删除")	
	@Column(length=1)@MaxLength(length=1)
	String deleted;
	 
	@Wit(cnname="所属的分类")
	@ManyToOne	@LazyToOne(LazyToOneOption.FALSE) 
	private Category commonCategory;   

    @ManyToOne @LazyToOne(LazyToOneOption.FALSE)
    private Category category;
    
    
	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}	

	
	public String getDeleted() {
		return deleted;
	}

	public void setDeleted(String deleted) {
		this.deleted = deleted;
	}

	
	public String getType_code() {
		return type_code;
	}

	public void setType_code(String type_code) {
		this.type_code = type_code;
	}

	public Category getCommonCategory() {
		return commonCategory;
	}

	public void setCommonCategory(Category commonCategory) {
		this.commonCategory = commonCategory;
	}

	public String getParent_id() {
		return parent_id;
	}

	public void setParent_id(String parent_id) {
		this.parent_id = parent_id;
	}

	public Category getCategory() {
		return category;
	}

	public void setCategory(Category category) {
		this.category = category;
	}

}
